<!DOCTYPE html>
<html>

<head>
	<meta charset="UTF-8">
	<title>地震局培训平台</title>
	<link rel="stylesheet" href="style/train2.css" />
</head>

<body>
	<div id="show">
		<div class="title2">应急技能</div>
		<div class="list">
			<!-- <div class="box">
				<div class="img" style="background-image: url(../image/t_img1.jpg);">
				</div>
				<div class="list_title">资料</div>
				<div class="infobox">
					<div class="read">阅读
						<span>0/次</span>
					</div>
					<div class="like">❤收藏
						<span>5646</span>
					</div>
				</div>
			</div> -->
		</div>
		<!-- <div class="pagebox">
			<div class="pageborder"></div>
			<div class="numbox">
				<div class="page">1</div>
				<div class="page in">2</div>
				<div class="page">3</div>
			</div>
		</div> -->
	</div>

	<script type="text/javascript" src="script/jquery.min.js"></script>
	<script type="text/javascript" src="script/ishoock.tools.js"></script>
	<script>
		var CDN = "http://101.201.113.151:9230/";
		$(function () {
			$(".img").on("mouseover", function () {
				$(this).in();
			});
			$(".img").on("mouseleave", function () {
				$(".img").removeIn();
			});

			$.ajax({
				type: "GET",
				url: "http://101.201.113.151:9230/traning/getListofTraningInfo?type=0&pageSize=12&page=1",//访问的链接
				dataType: "json",  //数据格式设置为jsonp
				// jsonp:"callback",
				async: true,
				success: function (data) {  //成功的回调函数
					console.log(data);

					for (var i = 0; i < data.result.length; i++) {
						// if (data.result[i].title) {
						var item =
							'<div class="box">' +
							'<div class="img"></div>' +
							// '<div class="img">'+ '<img src="' + CDN + data.result[i].imageUrl + '"data-url="' + data.result[i].linkUrl + '" />' +'</div>' +
							'<div class="list_title">' + data.result[i].title + '</div>' +
							'<div class="infobox">' +
							'<div class="text">' + '阅读' + data.result[i].collectionNum + '<span>' + '万/次' + '</span>' + '</div>' +
							'<div class="like">' + '❤收藏' + '<span>' + data.result[i].readNum + '</span>' + '</div>' +
							"</div>" +
							'</div>';
						$(".list").append(item);
						$(".box").data("result", data.result);
						// console.log(data.result[i]); 
						// }
					}
				},
				error: function (e) {
				}
			});

			$(document).on('click', '.box', function () {
				var index = $(".box").index(this);
				
				var result = $(".box").data("result")[index].id;
				console.log(result);
				window.open("details_train.html" +"?value="+ result);
				// window.location.href="details_train.html" +"?result="+ $(".box").data("result")[index];
			})

		})
	</script>
</body>

</html>